import QtQuick 2.6
import QtQuick.Layouts 1.1

import "../../Base/UiBase"
import "../../Base/Config"
import Code 1.0

import "../../Comment" as Comment

Rectangle {
    id: root

    color: Color.background

    Component.onCompleted: {
        messageModel.append({
                                user: {
                                    name: "奥特曼打小怪兽  ",
                                    head: "../../../resources/tests/touxiang01.svg"
                                },
                                ref: {
                                    user: {
                                        name: "欢乐的0403"
                                    },
                                    image: "../../../resources/tests/648ac377gw1ex90a9foidj20cx0jeab6.jpg"
                                },
                                messageText: "123123123aaaaaaaa",
                                time: 1
                            })
        messageModel.append({
                                user: {
                                    name: "奥特曼打小怪兽  ",
                                    head: "../../../resources/tests/touxiang01.svg"
                                },
                                ref: {
                                    user: {
                                        name: "欢乐的0403"
                                    },
                                    text: "1111111111"
                                },
                                messageText: "!!!!!!!!!!!!!!!!!!!!!!!!!",
                                time: 2
                            })
        messageModel.append({
                                user: {
                                    name: "奥特曼打小怪兽  ",
                                    head: "../../../resources/tests/touxiang01.svg"
                                },
                                ref: {
                                    user: {
                                        name: "欢乐的0403"
                                    },
                                    text: "11111111111111111111111111111111"
                                },
                                messageText: "!!!!!!!!!!!!!!!!!!!!!!!!!",
                                time: 2
                            })
        messageModel.append({
                                user: {
                                    name: "奥特曼打小怪兽  ",
                                    head: "../../../resources/tests/touxiang01.svg"
                                },
                                ref: {
                                    user: {
                                        name: "欢乐的0403"
                                    },
                                    text: "1111111111111111111111111111112222222222222222222222222222211"
                                },
                                messageText: "!!!!!!!!!!!!!!!!!!!!!!!!!这里应该有多行这里应该有多行这里应该有多行这里应该有多行这里应该有多行  ",
                                time: 3
                            })
        messageModel.append({
                                user: {
                                    name: "奥特曼打小怪兽  ",
                                    head: "../../../resources/tests/touxiang01.svg"
                                },
                                ref: {
                                    user: {
                                        name: "欢乐的0403"
                                    },
                                    image: "../../../resources/tests/648ac377gw1ex90a9foidj20cx0jeab6.jpg"
                                },
                                messageText: "123123123aaaaaaaa",
                                time: 4
                            })
    }

    MouseArea {
        anchors.fill: parent
        z: -1
    }

    ColumnLayout {
        anchors.fill: parent
        spacing: 0

        // header
        Rectangle {
            Layout.fillWidth: true
            Layout.preferredHeight: 96 * Size.ratio
            color: Color.foreground
            RowLayout {
                width: parent.width
                height: parent.height
                MouseArea {
                    Layout.preferredWidth: 80 * Size.ratio
                    Layout.fillHeight: true
                    SvgzImage {
                        width: 80 * Size.ratio
                        height: 96 * Size.ratio
                        source: "../../../resources/comment/fanhiu01.svg"
                    }
                    onClicked: root.visible = false
                }
                Item {
                    Layout.fillWidth: true
                    Layout.fillHeight: true
                    Text {
                        anchors.centerIn: parent
                        text: qsTr("私信")
                        font.pixelSize: Size.titleFont
                    }
                }
            }
            BottomDivider {
            }
        } // end header

        // body
        ListView {
            Layout.fillWidth: true
            Layout.fillHeight: true
            z: -1
            spacing: 0
            delegate: Comment.Comment {}
            model: ListModel {
                id: messageModel
            }
        } // end body
    }
}
